package com.imooc.framework.stream;

import java.security.Key;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class GroupDemo {

    public static void main(String[] args) {
        Stream<Employee> stream = Employee.getEmpList().parallelStream();
//        Map<String, List<Employee>> map = stream.collect(Collectors.groupingBy(Employee::getDept));

//        Set<String> keySet = map.keySet();
//        keySet.forEach(key->{
//            List<Employee> list = map.get(key);
//            System.out.println(key + "：");
//            System.out.println(list);
//        });

        Map<String,Map<String,Map<String,List<Employee>>>> mapMap = stream.collect(Collectors.groupingBy(Employee::getDept,Collectors.groupingBy(Employee::getSex,Collectors.groupingBy(Employee::getName))));
        Set<String> keySet = mapMap.keySet();
        keySet.forEach(key->{
            System.out.println("key：" + key);


            System.out.println(mapMap.get(key));
        });


        System.out.println(mapMap);

    }
}
